<?php
/**  
* PrinterView.php
* 
*/

require_once(CLASS_PATH."/__autoload.php");

class PrinterView extends MakerPool
{
   protected function getResult($result)
   {
	  $arr = $arrStr = $arrMaker = array();
	  $flagMaker = $flagType = $data = $pName = $maker = $linkSerial = null;     
	  $i = 0;
	   
      while($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
	  {
		$maker 	  = $row['pMaker']; 
		$makerStr = explode('(', $maker);			
		$makerStr = explode(' ', $makerStr[0]);	
		$makerStr = $makerStr[0];
		$comment  =  trim($row['pComment']);	
		$type 		   = $row['pType'];
		$encoded_Maker = urlencode($maker);			
		$rst 		   = $this->sameCompany($maker) ;
		
		if(empty($rst))
		{
			$arr[] = (sizeof($arr)) ? "</dl>" : null ;	
			$arr[] = "<dl><dt><h2 id='p{$i}' ><a href='goto?goMaker=$encoded_Maker' title='$maker 홈피로 이동' >{$maker}</a></h2></dt>"; 
			$arrMaker[]= "<a href='#p{$i}' >{$makerStr}</a>";		
			$i++;   
		}

         $arr[] 	= "<dd>";
		 $arr[] 	= $this->sameType($type) ;
		
		 $encoded_pName  = urlencode($row['pName']);		 
		 $arrStr 		= $this->cleanKeyword($this->load_args, ' ');
		 $length 		= count($arrStr);

		 while($length--)
		 {	
		 	$row['pName'] = $this->addMark($arrStr[$length], $row['pName']);
		 }
		
		 $encoded_linkSerial = (isset($row['psSerial']))  ? urlencode($row['psSerial']) : null;
		 $linkSerial         = (!!$encoded_linkSerial) ? "|{$encoded_linkSerial}" : null;


         $arr[] = "<a href='/2013p79/common/class/search/prtsup.php?pSerial={$row['pSerial']}{$linkSerial}&pName=$encoded_pName' data-serial='{$row['pSerial']}' class='box menu-2' contextmenu='html5polyfill' >{$row['pName']}</a> ";
		 $arr[] = (!empty($comment)) ? "<br /><span class='sType'></span> <span class='leftpadding20' data-width=630 > &bull;&hellip; {$comment}</span>" : null;
		 $arr[] = '</dd>';  
	  }   // EOF while

	  $this->set_numShowMaker(5);	  // #makerpool maker 갯수 지정
	  
	  $arrMaker = $this->arrangeMaker($arrMaker);
	  $arr 		= '<section id="searchResult">'.implode('', $arr)."</dl></section>".$this->get_goTopButton();
	  $data 	= $arrMaker."<div id='showChoice' ></div>".$arr;
//	  header("Content-type:text/html; charset=utf-8");    // html형식으로 데이터를 전송하는 경우 적용  
	  return  $data; 
	}    
	
		
}
?>